package service.impl;

import bean.Pagination;
import service.BaseService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
@Service("baseService")
public class BaseServiceImpl implements BaseService {
    @Autowired
    public SqlSessionTemplate sqlSession;
    @Override
    public List<Map<String, Object>> getDicList(String code) {
        return sqlSession.selectList("baseMapper.getDicList",code);
    }

    @Override
    public <T>PageInfo<T> qryList(String mapper, Pagination page) {
        PageHelper.startPage(page.getPage(), page.getSize());
        List<T> list = sqlSession.selectList(mapper, page);
        return new PageInfo<>(list);
    }
}
